package com.relytosoft.mizar.media.display.api.pojo.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.relytosoft.dubhe.common.core.utils.BeanCopyUtils;
import com.relytosoft.mizar.media.display.api.entity.Preset;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 预置点数据传输类
 *
 * @author hj
 * @version 1.0
 * @date 2022/4/27 10:38
 * @ClassName PresetDto
 */
public class PtzPresetDto implements Serializable {

    private static final long serialVersionUID = 8426922709665926861L;

    /**
     * 主键ID
     */
    @TableId(value="ID", type= IdType.AUTO)
    @ApiModelProperty(value = "主键ID")
    private Integer id;



    /**
     * 通道
     */
    @ApiModelProperty(value = "通道id",required = true)
    @TableField("CHANNEL_ID")
    @NotNull(message = "云台不能为空")
    private Integer channelId;

    /**
     * 预置位名称
     */
    @ApiModelProperty(value = "预置位名称",required = true)
    @TableField("PRESET_NAME")
    @NotBlank(message = "预置位名称不能为空")
    private String presetName;

    /**
     * 预置位索引
     */
    @ApiModelProperty(value = "预置位索引",required = true)
    @TableField("PRESET_INDEX")
    @NotNull(message = "预置位索引不能为空")
    private Integer presetIndex;

    /**
     * 是否守望点/看守位
     */
    @ApiModelProperty(value = "是否守望点/看守位")
    @TableField("IS_GUARD")
    private Integer isGuard;

    public PtzPresetDto() {
    }

    public PtzPresetDto(Integer presetIndex,Integer channelId) {
        this.presetName = presetIndex + "-预置点_" + presetIndex;
        this.presetIndex = presetIndex;
        this.channelId = channelId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getChannelId() {
        return channelId;
    }

    public void setChannelId(Integer channelId) {
        this.channelId = channelId;
    }

    public String getPresetName() {
        return presetName;
    }

    public void setPresetName(String presetName) {
        this.presetName = presetName;
    }

    public Integer getPresetIndex() {
        return presetIndex;
    }

    public void setPresetIndex(Integer presetIndex) {
        this.presetIndex = presetIndex;
    }

    public Integer getIsGuard() {
        return isGuard;
    }

    public void setIsGuard(Integer isGuard) {
        this.isGuard = isGuard;
    }

    public static  PtzPresetDto buildDto(Preset preset){
        PtzPresetDto dto = new PtzPresetDto();
        BeanCopyUtils.copy(preset,dto);
        return dto;
    }

    public Preset buildEntity(){
        Preset preset = new Preset();
        BeanCopyUtils.copy(this,preset);
        return preset;
    }
}
